package hashtable;

import java.util.Hashtable;

/**
 * Created by 5406160@qq.com on LiBoWen 李博闻.
 *
 * @ClassName : HashtableDemo
 * @Author : 54061
 * @Date: 2022/2/16 21:18
 */
public class HashtableDemo {
    public static void main(String[] args) throws InterruptedException {
        //HashMap<String.String> hm =new HashMap<>();
        Hashtable<String,String> hm = new Hashtable<>();

        Thread t1 = new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 250;i++){
                    hm.put(i+"",i+"");//双列集合的0-24个元赋值 0-0 1-1 -2-2
                }
            }
        });

        Thread t2 = new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i =250; i <501;i++){
                    hm.put(i+"",i+"");//双列集合的25-50个元素赋值 250-250

                }
            }
        });
        t1.start();
        t2.start();
        System.out.println("-----");
        //为了t1和t2能把数据全部添加完毕
        Thread.sleep(2000);


        for (int i = 0; i <501;i++){
            System.out.println(hm.get(i+""));
        }
    }
}
